package com.ruoyi.project.dict.handwriting.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.dict.handwriting.mapper.HandwritingMapper;
import com.ruoyi.project.dict.handwriting.domain.Handwriting;
import com.ruoyi.project.dict.handwriting.service.IHandwritingService;
import com.ruoyi.common.utils.text.Convert;
import com.ruoyi.framework.aspectj.lang.annotation.DataSource;
import com.ruoyi.framework.aspectj.lang.enums.DataSourceType;

/**
 * 书法大全Service业务层处理
 * 
 * @author shixiangwen
 * @date 2020-02-13
 */
@Service
@DataSource(value = DataSourceType.DICT)
public class HandwritingServiceImpl implements IHandwritingService {

	@Autowired
	private HandwritingMapper handwritingMapper;

	/**
	 * 查询书法大全
	 * 
	 * @param id 书法大全ID
	 * @return 书法大全
	 */
	@Override
	public Handwriting selectHandwritingById(Long id) {
		return handwritingMapper.selectHandwritingById(id);
	}

	/**
	 * 查询书法大全列表
	 * 
	 * @param handwriting 书法大全
	 * @return 书法大全
	 */
	@Override
	public List<Handwriting> selectHandwritingList(Handwriting handwriting) {
		return handwritingMapper.selectHandwritingList(handwriting);
	}

	/**
	 * 新增书法大全
	 * 
	 * @param handwriting 书法大全
	 * @return 结果
	 */
	@Override
	public int insertHandwriting(Handwriting handwriting) {
		handwriting.setCreateTime(DateUtils.getNowDate());
		return handwritingMapper.insertHandwriting(handwriting);
	}

	/**
	 * 修改书法大全
	 * 
	 * @param handwriting 书法大全
	 * @return 结果
	 */
	@Override
	public int updateHandwriting(Handwriting handwriting) {
		handwriting.setUpdateTime(DateUtils.getNowDate());
		return handwritingMapper.updateHandwriting(handwriting);
	}

	/**
	 * 删除书法大全对象
	 * 
	 * @param ids 需要删除的数据ID
	 * @return 结果
	 */
	@Override
	public int deleteHandwritingByIds(String ids) {
		return handwritingMapper.deleteHandwritingByIds(Convert.toStrArray(ids));
	}

	/**
	 * 删除书法大全信息
	 * 
	 * @param id 书法大全ID
	 * @return 结果
	 */
	@Override
	public int deleteHandwritingById(Long id) {
		return handwritingMapper.deleteHandwritingById(id);
	}
}
